package com.welsy.iter.vo
{
	import com.welsy.iter.vo.iter.pattern.*;
	import com.welsy.iter.model.IterModelLocator;		
			
	[Bindable]
	public class IterComponentsVO extends CourseItem 
	{						
      public var iter:IterVO = new IterVO;
      
      private var _items:Array;
      
      private var _load:Boolean = false;

      public function IterComponentsVO() {
         _items = new Array();
      }

      override public function addItem(item:ICourseItem):void {
         _items.push(item);
      }

      override public function removeItem(item:ICourseItem):void {
         var i:uint;
         // Loop through all the child elements.
         for(i = 0; i < _items.length; i++) {
            // If one of the elements matches the 
            // parameter remove it from the array.
            if(_items[i] == item) {
               _items.splice(i, 1);
               break;
            }
         }
      }
      override public function iterator():ICourseIterator {
         
         return new ArrayCourseIterator(_items);
      }
      
      public function getCollection():Array {         
         return _items;
      }  
  }
}